package com.vhall.component.controller.lottery.facade;


import com.vhall.component.entity.lottery.vo.*;
import com.vhall.component.plugin.common.annotation.RedisLock;
import com.vhall.component.plugin.common.annotation.VssTokenAuth;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * 抽奖
 *
 * @author longzhen.gong
 * @date 2021/6/28 10:55
 */
@FeignClient(name = "LotteryFacade", path = "/v4/lottery")
public interface LotteryFacade {


    @RequestMapping("/time")
    String time();

    /**
     * 获取可以参与抽奖的人数
     */
    @PostMapping(value = "/count")
    LotteryCountRsp count(@Validated LotteryCountReqVO req);

    /**
     * 当前可参与抽奖的人数(排除主持人、嘉宾、助理、已中奖人数)
     * @param req
     * @return
     */
    @PostMapping(value = "/total")
    Long total(@Validated LotteryCountReqVO req);
    /**
     * 搜索符合范围条件的抽奖用户名单
     */
    @GetMapping(value = "/search")
    Map<String, Object> search(@Validated LotterySearchReqVO req);

    /**
     * 导入数据
     */
    @PostMapping(value = "/import-user")
    LotteryImportRspVO importUser(@Validated LotteryImportReqVO lotteryImportReqVO);

    /**
     * 发起抽奖
     */
    @PostMapping(value = "/add")
    LotteryV4AddRspVO add(@Validated LotteryV4AddReqVO req);

    /**
     * 抽奖结束
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/end")
    @RedisLock(redisKey = "#req.lotteryId")
    LotteryRspVO end(@Validated V4LotteryEndReqVO req);

    @PostMapping(value = "/award")
    LotteryAwardRspVO award(@Validated LotteryAwardReqVO reqVo);

    @PostMapping(value = "/check-award-info")
    CheckAwardInfoRspVO checkAwardInfo(@Validated CheckAwardInfoReqVO reqVo);

    /**
     * 获取抽奖中奖人名单
     *
     * @author song.dong
     */
    @GetMapping(value = "/users-get")
    WatchLotteryUsersGetRspVO usersGet(@Validated V4LotteryUsersGetReqVO reqVo);

    /**
     * 中奖
     */
    @PostMapping(value = "/publish")
    String publish(@Validated V4LotteryPublishReqVO reqVo);

    /**
     * 抽奖信息
     * @param reqVo
     * @return
     */
    @VssTokenAuth
    @PostMapping("/info")
    LotteryInfoVO info(@Validated V4LotteryPublishReqVO reqVo);

    /**
     * 中奖纪录
     *
     * @param reqVo
     * @return
     */
    @PostMapping("/winning-record")
    LotteryWinningInfo winningInfo(@Validated V4LotteryRecordReqVO reqVo);

    /**
     * 中奖者地址信息
     *
     * @param reqVo
     * @return
     */
    @PostMapping("/winning-address")
    LotteryRecordVO lotteryWinnerAddress(@Validated V4LotteryRecordReqVO reqVo);
}
